//
//  GHChooseOrgSCell.m
//  ZT_iOS
//
//  Created by 周 光辉 on 2019/4/23.
//  Copyright © 2019年 Brigitte. All rights reserved.
//

#import "GHChooseOrgSCell.h"
#import "Masonry.h"
#import "NSString+ZTUrl.h"
#import "ZTMacros.h"
#import "ZTLibTheme.h"


@implementation GHChooseOrgSCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        //        self.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
        [self p_setupView];
    }
    return self;
}


- (void)p_setupView
{
    [self.contentView addSubview:self.blueImageView];
    [self.contentView addSubview:self.orgLabel];
    [self.contentView addSubview:self.seleImageView];
    [self.contentView addSubview:self.depLabel];
    [self.contentView addSubview:self.professionalImageView];
    
//    //添加图片cell点击事件
//    UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapProfileImage)];
//    singleTap.numberOfTapsRequired = 1;
//    [self.qrCodeImageView addGestureRecognizer:singleTap];
    
    [self makeConstraintLayout];
}

- (void)makeConstraintLayout
{
    [self.blueImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView).offset(17);
//        make.height.equalTo(@(88));
        make.left.and.right.equalTo(self.contentView);
//        make.width.equalTo(@(Main_Screen_Width));
        make.bottom.equalTo(self.contentView).offset(-6);
    }];
    
    [self.seleImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.blueImageView);
        make.right.equalTo(self.contentView).offset(-26);
        make.width.and.height.equalTo(@(20));
    }];
    
    [self.orgLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.blueImageView.mas_top).offset(26);
//        make.centerY.equalTo(self.blueImageView);
//        make.height.equalTo(@25);
//        make.width.equalTo(@(Main_Screen_Width-100));
        make.left.equalTo(self.blueImageView.mas_left).offset(20);
        make.right.equalTo(self.contentView).offset(-100);
        make.bottom.equalTo(self.blueImageView.mas_centerY);
    }];
    [self.depLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.orgLabel.mas_bottom);
        make.height.equalTo(@20);
        make.left.equalTo(self.orgLabel.mas_left);
    }];
    [self.professionalImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.depLabel.mas_top).offset(4);
        make.height.equalTo(@14);
        make.width.equalTo(@18);
        make.left.equalTo(self.depLabel.mas_right).offset(12);
    }];
    
}

- (UILabel *)orgLabel
{
    if (!_orgLabel) {
        _orgLabel = [[UILabel alloc] init];
        _orgLabel.textColor = [UIColor whiteColor];
        _orgLabel.font = ZTFONT(19);
        _orgLabel.text = @"智慧城市";
        _orgLabel.numberOfLines = 0;
    }
    return _orgLabel;
}

-(UILabel *)depLabel
{
    if (!_depLabel) {
        _depLabel =[[UILabel alloc] init];
        _depLabel.textColor = [UIColor whiteColor];
        _depLabel.font = ZTFONT(12);
        _depLabel.text = @"部门人员";
    }
    return _depLabel;
}

-(UIImageView *)blueImageView
{
    if (!_blueImageView) {
        _blueImageView = [UIImageView new];
        _blueImageView.userInteractionEnabled = YES;
        
        NSBundle *associateBunle = [NSBundle bundleWithPath:[[NSBundle bundleForClass:[self class]] pathForResource:@"ZTPrivateLib" ofType:@"bundle"]];
        _blueImageView.image = [UIImage imageNamed:@"blueBlackImg"
                                          inBundle: associateBunle
                 compatibleWithTraitCollection:nil];
    }
    return _blueImageView;
}

-(UIImageView *)seleImageView
{
    if (!_seleImageView) {
        _seleImageView = [UIImageView new];
        _seleImageView.userInteractionEnabled = YES;
        NSBundle *associateBunle = [NSBundle bundleWithPath:[[NSBundle bundleForClass:[self class]] pathForResource:@"ZTPrivateLib" ofType:@"bundle"]];
        _seleImageView.image = [UIImage imageNamed:@"selewhiteorg_n"
                                          inBundle: associateBunle
                 compatibleWithTraitCollection:nil];
    }
    return _seleImageView;
}
-(UIImageView *)professionalImageView
{
    if (!_professionalImageView) {
        _professionalImageView = [UIImageView new];
        _professionalImageView.userInteractionEnabled = YES;
        NSBundle *associateBunle = [NSBundle bundleWithPath:[[NSBundle bundleForClass:[self class]] pathForResource:@"ZTPrivateLib" ofType:@"bundle"]];
        _professionalImageView.image = [UIImage imageNamed:@"professionalImageView"
                                                  inBundle: associateBunle
                         compatibleWithTraitCollection:nil];
    }
    return _professionalImageView;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
